package com.clcg;

import com.lcg.TestService;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;

/**
 * 作者: LCG
 * 日期: 2020/8/4 17:35
 * 描述:
 */
public class TestClient {

    public static void main(String[] args) throws IOException, KeeperException, InterruptedException {

        //从zookeeper拉取注册的服务信息
        ZooKeeper zooKeeper=new ZooKeeper("localhost",2181,new TestClientWatcher());

        byte[] data = zooKeeper.getData("/mydubbo/com.lcg.TestService",new TestClientWatcher() , null);

        String serviceName = new String(data);

        TestInterfaceProxy<TestService> testInterfaceProxy=new TestInterfaceProxy<TestService>();

         TestService proxy = testInterfaceProxy.getInterfaceProxy("localhost", 10000, serviceName);

        String test01 = proxy.test01("99999999999");

        System.out.println("====client===》"+test01);


    }

}
